<?php
/**
 * 轻云网络验证系统
 * =======================================================
 * 版权所有(C) 2019-2039 daenx.cn，并保留所有权利。
 * 作者：Daen大恩
 * 作者QQ: 1330166565
 * 开发群：661059773
 * =======================================================
 */
    include 'farmwork.php';
	include 'chushi.php';
	header("content-type:text/html;charset=utf-8");
	login();
	
	$id = $_GET['id'];
	$sql = "SELECT * FROM `daili` WHERE id ='$id';";
	$result=mysqli_query($con,$sql);
	if($result&&mysqli_num_rows($result)){
	   while ($row=mysqli_fetch_assoc($result)) {
			  $domain = $row['domain'];
			  $qq = $row['qq'];
			  $ycp = $row['ycp'];
			  $pass = $row['pass'];
			  $yumi = $row['yumi'];
			  $authup = $row['up'];
			  if($uid != $authup){
				  echo("<script language=\"javascript\" type=\"text/javascript\" src=\"/data/assets/js/jquery.min.js\"></script><script language=\"javascript\" type=\"text/javascript\" src=\"/data/assets/layer/layer.js\"></script><script>layer.open({  type: 1  ,title: false   ,closeBtn: false  ,area: '200px;'  ,shade: 0.8  ,id: 'LAY_layuipro'   ,resize: false  ,btn: ['确定']  ,moveType: 1   ,content: '<div style=\"padding: 30px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;\">请勿修改别人的下级代理！<br>警告一次，已记录系统<br>多次违规将封禁您的代理账号</div>'  ,success: function(layero){ var btn = layero.find('.layui-layer-btn');  btn.find('.layui-layer-btn0').attr({ href: 'daili.php' });  }});</script>");
			  }
	   }
	}	

	
	$action = $_GET['action'];
	if($action=='do'){
		$id = $_POST['id'];
		$domain = $_POST['domain'];
		$qq = $_POST['qq'];
		$yumi = $_POST['yumi'];
		$pass = $_POST['pass'];
		$bz = $_POST['bz'];
		
		$sql = "UPDATE `daili` SET `domain` = '$domain',`pass` = '$pass',`qq` = '$qq',`yumi` = '$yumi',`bz` = '$bz' WHERE `id` = '$id';";
	    mysqli_query($con,$sql);
		mysqli_close();
		echo("<script language=\"javascript\" type=\"text/javascript\" src=\"/data/assets/js/jquery.min.js\"></script><script language=\"javascript\" type=\"text/javascript\" src=\"/data/assets/layer/layer.js\"></script><script>layer.open({  type: 1  ,title: false   ,closeBtn: false  ,area: '200px;'  ,shade: 0.8  ,id: 'LAY_layuipro'   ,resize: false  ,btn: ['确定']  ,moveType: 1   ,content: '<div style=\"padding: 30px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;\">更新成功！</div>'  ,success: function(layero){ var btn = layero.find('.layui-layer-btn');  btn.find('.layui-layer-btn0').attr({ href: 'daili.php' });  }});</script>");
	}

$li66='class="active"';
$li660='class="active"';
?>
<?php include 'header.php';?>
    <title>更新代理-<?php echo $title?></title>
<?php include 'list.php';?>
    <!--main content start-->
    <section id="main-content">
        <section class="wrapper">
<?php include 'overview.php';?>
            <div class="row">
                <div class="col-lg-12">
                    <!--work progress start-->
                    <section class="panel">
                        <div class="panel-body progress-panel">
                            <div class="task-progress">
                                <h1>更新代理</h1>
                                <p>填写新的代理信息并保存.</p>
                            </div>
                        </div>						
                         <form action="daili-chanage.php?action=do" method="post"  role="form">
                            <div class="form-group">
                                <label for="txtDomain">账号</label>
                                <input type="text" name="domain" class="form-control" value='<?php echo $domain?>'>
                            </div>
                            <div class="form-group">
                                <label for="txtDomain">密码</label>
                                <input type="text" name="pass" class="form-control" value='<?php echo $pass?>'>
                            </div>

                            <div class="form-group">
                                <label for="txtDomain">联系人QQ</label>
                                <input type="text" name="qq" class="form-control" value='<?php echo $qq?>'>
                            </div>
							<div class="form-group">
                                <label for="txtDomain">状态</label>
                                <select name="yumi" class="form-control">
                                            
											<?php if($yumi == 1)
											{echo '<option value="0">正常</option>
                                            <option value="1" selected>禁用</option>';}
											else 
											{echo '<option value="0" selected>正常</option>
                                            <option value="1">禁用</option>';}
											?>
											
                                        </select>
								<span class="help-block">当前状态：<?php if($yumi==1){ echo "<font color='red'>禁用中</font>";} else {echo "<font color='red'>正常</font>";} ?></span>
																			
                            </div>
							<div class="form-group">
								<label for="txtDomain">备注</label>
								<input type="text" name="bz" class="form-control" value='<?php echo $bz?>'/>
							</div>
					
							<input type='hidden' name="id" class="user" value='<?php echo $id?>'/>
			<div id="bottom">
			  <button class="btn btn-info" type="submit" value="true" id="submit"/><strong>更新信息</strong></button>
            </div>
                        </form>
                    </section>
                    <!--work progress end-->
                </div>

        </section>
    </section>
    <!--main content end-->

<?php include 'footer.php';?>